package com.sjf.day02.Demo;

import cn.hutool.Hutool;
import cn.hutool.core.util.JNDIUtil;
import cn.hutool.core.util.PrimitiveArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.db.DbUtil;
import cn.hutool.db.sql.SqlUtil;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Set;

/**
 * @author <huangtang>
 * @since 2021/12/27 11:31
 **/
public class HutoolTest {

    public static void main(String[] args) {
        //获取Hutool中工具类的class
        //Set<Class<?>> set = Hutool.getAllUtils();
        //for (Class<?> aClass : set) {
        //    System.out.println(aClass.getName());
        //}
        Hutool.printAllUtils();
        //String sql = SqlUtil.formatSql("select * from student");
        //System.out.println(sql);
        //StrUtil.isEmptyIfStr();
        DataSource ds = DbUtil.getDs();
        Connection connection = null;
        Statement statement = null;
        try {
            connection = ds.getConnection();
            statement = connection.createStatement();
            //statement.execute("select * from dept");
            ResultSet resultSet = statement.getResultSet();
            while(resultSet.next()){
                System.out.printf("%s %s %s  \n",resultSet.getObject(1),resultSet.getObject(2),
                        resultSet.getObject(3));
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

        System.out.println(ds);
    }
}
